Projects

In the Project tab you can define the parameters of the code generation:




Database Type


Choose your type of database.



Connection String


The connection string of your database. The common formats are:


Database

ADO.NET Connection used by Gen4DO

Connection String

Access

OleDbConnection

Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=<Path of your .mdb file>

SQL Server 2000/2005 (SQL Server authentication)

SqlConnection

Data Source=<server name>;Initial Catalog=<database>;User ID=<login>;Password=<password>;

SQL Server 2000/2005 (Windows authentication)

SqlConnection

Data Source=<server name>;Initial Catalog=<database>;Integrated Security=SSPI;


The database login must have permission to read all tables/views.



Output directory


All source code file are generated in this directory.



Namespace


The namespace of the generated classes, such as "MyProject.BusinessLogic".



Notation


The notation of the class and property names of the generated classes.

You can adopt the original names or choose "Pascal" to convert them to a Pascal-like notation.


Examples:


Table name

Notation

Class name

SAMPLE_TABLE

Original

SAMPLE_TABLE

SAMPLE_TABLE

Pascal

SampleTable

SAMPLE TABLE

Original

SAMPLE_TABLE

SAMPLE TABLE

Pascal

SampleTable



Concurrency Strategy


If you are designing a multi-user application, you have to deal with Concurrency Management.

What if two users retrieve the same record, doing some changes and both are writing their changes back to the database?

If there is no Concurrency Strategy ("last save wins"), all the changes of the first user are overwritten with the second user data and

the application will not recognize this.


If you want your application being aware of this situation, you can set the Concurrency Strategy to "OptimisticLocking".

Then the update of the second user will throw a System.Data.DBConcurrencyException so that the application can react to it.


If you want to use Optimistic Locking, the table must have a special column where the current version of the record is stored:


Column name

Data type

Default

VERSION

Integer, NOT NULL

0



Generate Data Transfer Objects


If you have to go across application boundaries you will need a way to serialize the data of a Data Object. Then you can use Data Transfer Objects. Data Transfer Objects contain only the serializable data of a Data Object. If you check this option, an additional class with suffix “DTO” is created for each table. The DTO classes are generated in the namespace “<Your namespace>.DataTransferObjects” so you can put them in their own assembly to share them between two applicactions (see Data Transfer Objects).



Keep database-specific members internal


In case of a good architecture of your application, this option should be checked. It sets the access modifier of all methods that have database-specific parameters to internal. That prevents other parts of the application (for example the UI) from using database-specific code. If this option is not checked, the access modifier is set to public.